class CreatePosts < ActiveRecord::Migration
  def self.up
    create_table :posts do |t|
			t.string :title, :null=>false
			t.string :slug
			t.text :content
			t.string :mood
			t.string :music
			t.string :cached_tag_list
			t.integer :user_id, :null=>false
			t.integer :community_id
			t.integer :post_access_id, :null=>false, :default=>PostAccess::ALLOW_ALL
			t.integer :comment_access_id, :null=>false, :default=>CommentAccess::ALLOW_ALL
			t.integer :avatar_id
			t.integer :comments_count, :default=>0
      t.timestamps
    end
    
    add_index :posts, [:user_id], :name=>"fk_user"
    add_index :posts, [:community_id], :name=>"fk_community"
  end

  def self.down
    drop_table :posts
  end
end
